package com.barbeque.mall.service.wx;

import com.barbeque.mall.bean.issue.MarketIssueExample;
import com.barbeque.mall.bean.user.MarketCollect;
import com.barbeque.mall.bean.user.MarketCollectExample;
import com.barbeque.mall.mapper.MarketCollectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 苏东宇
 * @since 2022/07/21 15:19
 */
@Service
public class WxCollectServiceImpl implements WxCollectService {

    @Autowired
    MarketCollectMapper marketCollectMapper;

    /**
     * 查询商品收藏
 * @param goodsId
     * @return java.util.List<com.barbeque.mall.bean.user.MarketCollect>
     * @author 苏东宇
     * @since 2022/07/21 16:46
     */
    @Override
    public List<MarketCollect> getCollectByGoodsId(Integer goodsId) {
        MarketCollectExample marketCollectExample = new MarketCollectExample();
        MarketCollectExample.Criteria criteria = marketCollectExample.createCriteria();
        criteria.andTypeEqualTo(new Byte("0"));
        criteria.andValueIdEqualTo(goodsId);
        criteria.andDeletedEqualTo(false);
        List<MarketCollect> marketCollects = marketCollectMapper.selectByExample(marketCollectExample);


        return marketCollects;
    }
}
